#!/bin/bash
if [[ ! -z $1 ]] && [[ -d $1 ]] && [[ -z ${unline_path} ]]
then
PREHOME=$1
elif [[ ! -z ${unline_path} ]]
then
PREHOME=${unline_path}
else
PREHOME=${HOME}"/unline"
fi
fonts_list=$(ls -1l ${PREHOME}/fonts | grep -E '^-' | awk '{print $NF}' | grep -vE ".zip$")
for fl in ${fonts_list[@]}
do
#安装nerd字体，neovim/vim中显示图标会正常
sudo cp -R ${PREHOME}/fonts/${fl} /usr/share/fonts/truetype/custom
done
fonts_list_zip=$(ls -1l ${PREHOME}/fonts | grep -E '^-' | awk '{print $NF}' | grep -E ".zip$")
for fl in ${fonts_list_zip[@]}
do
  sudo unzip ${PREHOME}/fonts/${fl} -d /usr/share/fonts/truetype/custom
done
#生成核心字体信息
sudo mkfontscale  
sudo mkfontdir
sudo fc-cache -fv
# https://github.com/ronniedroid/getnf
